package com.gcstorage.tvdev.bean;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * 用户信息bean
 * created by Sanpark on 2020-10-22 10:20
 */
@Entity(tableName = "user_info")
public class UserInfo implements Parcelable {
    @PrimaryKey
    @NonNull
    private String id;//主键
    @ColumnInfo(name = "userId")
    private String userId;//用户id
    @ColumnInfo(name = "tenantId")
    private String tenantId;//租户ID
    @ColumnInfo(name = "account")
    private String account;//账号
    @ColumnInfo(name = "nickName")
    private String name;//昵称
    @ColumnInfo(name = "realName")
    private String realName;//真名
    @ColumnInfo(name = "avatar")
    private String avatar;//头像
    @ColumnInfo(name = "email")
    private String email;//邮箱
    @ColumnInfo(name = "phone")
    private String phone;//手机
    @ColumnInfo(name = "birthday")
    private String birthday;// 生日
    @ColumnInfo(name = "sex")
    private Integer sex;//性别
    @ColumnInfo(name = "roleId")
    private String roleId;//角色id
    @ColumnInfo(name = "deptId")
    private String deptId;//部门id
    @ColumnInfo(name = "postId")
    private String postId;//岗位id
    @ColumnInfo(name = "createUser")
    private Long createUser;//创建人
    @ColumnInfo(name = "createDept")
    private Long createDept;//创建部门
    @ColumnInfo(name = "createTime")
    private String createTime;//创建时间
    @ColumnInfo(name = "updateUser")
    private String updateUser;//修改人
    @ColumnInfo(name = "updateTime")
    private String updateTime;//修改时间
    @ColumnInfo(name = "status")
    private Integer status;//状态
    @ColumnInfo(name = "isDeleted")
    private Integer isDeleted;//是否已删除
    @ColumnInfo(name = "idCard")
    private String idCard;//身份证号
    @ColumnInfo(name = "orgId")
    private String orgId;//机构ID
    @ColumnInfo(name = "policeNo")
    private String policeNo;//警号
    @ColumnInfo(name = "userType")
    private String userType;//用户类型
    @ColumnInfo(name = "extDeptId")
    private String extDeptId;
    @ColumnInfo(name = "deptName")
    private String deptName;//当前部门
    @ColumnInfo(name = "postName")
    private String postName;//岗位名称
    @ColumnInfo(name = "postCode")
    private String postCode;//岗位编码
    @ColumnInfo(name = "loginToken")
    private String loginToken;//登录token

    @Ignore
    private Integer sort;//排序字段
    @Ignore
    private String initials;//姓名首字母
    @Ignore
    private String smsToken;//给外网消息token
    @Ignore
    private String favorite;//收藏 0:未收藏  1:已收藏
    @Ignore
    private boolean isCheck = false;//选中
    @Ignore
    private boolean isInDepart = false;//选中
    @Ignore
    private UserInfo postUserInfo;

    public UserInfo getPostUserInfo() {
        return postUserInfo;
    }

    public void setPostUserInfo(UserInfo postUserInfo) {
        this.postUserInfo = postUserInfo;
    }

    public boolean isInDepart() {
        return isInDepart;
    }

    public void setInDepart(boolean inDepart) {
        isInDepart = inDepart;
    }

    public boolean isCheck() {
        return isCheck;
    }

    public void setCheck(boolean check) {
        isCheck = check;
    }

    public String getPostName() {
        return postName;
    }

    public void setPostName(String postName) {
        this.postName = postName;
    }

    public String getPostCode() {
        return postCode;
    }

    public void setPostCode(String postCode) {
        this.postCode = postCode;
    }

    public String getExtDeptId() {
        return extDeptId;
    }

    public void setExtDeptId(String extDeptId) {
        this.extDeptId = extDeptId;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getFavorite() {
        return favorite;
    }

    public void setFavorite(String favorite) {
        this.favorite = favorite;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public String getPostId() {
        return postId;
    }

    public void setPostId(String postId) {
        this.postId = postId;
    }

    public Long getCreateUser() {
        return createUser;
    }

    public void setCreateUser(Long createUser) {
        this.createUser = createUser;
    }

    public Long getCreateDept() {
        return createDept;
    }

    public void setCreateDept(Long createDept) {
        this.createDept = createDept;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public String getPoliceNo() {
        return policeNo;
    }

    public void setPoliceNo(String policeNo) {
        this.policeNo = policeNo;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public String getSmsToken() {
        return smsToken;
    }

    public void setSmsToken(String smsToken) {
        this.smsToken = smsToken;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getInitials() {
        return initials;
    }

    public void setInitials(String initials) {
        this.initials = initials;
    }

    public String getLoginToken() {
        return loginToken;
    }

    public void setLoginToken(String loginToken) {
        this.loginToken = loginToken;
    }

    public UserInfo() {
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.userId);
        dest.writeString(this.tenantId);
        dest.writeString(this.account);
        dest.writeString(this.name);
        dest.writeString(this.realName);
        dest.writeString(this.avatar);
        dest.writeString(this.email);
        dest.writeString(this.phone);
        dest.writeString(this.birthday);
        dest.writeValue(this.sex);
        dest.writeString(this.roleId);
        dest.writeString(this.deptId);
        dest.writeString(this.postId);
        dest.writeValue(this.createUser);
        dest.writeValue(this.createDept);
        dest.writeString(this.createTime);
        dest.writeString(this.updateUser);
        dest.writeString(this.updateTime);
        dest.writeValue(this.status);
        dest.writeValue(this.isDeleted);
        dest.writeString(this.idCard);
        dest.writeString(this.orgId);
        dest.writeString(this.policeNo);
        dest.writeString(this.userType);
        dest.writeString(this.extDeptId);
        dest.writeString(this.deptName);
        dest.writeString(this.postName);
        dest.writeString(this.postCode);
        dest.writeString(this.loginToken);
        dest.writeValue(this.sort);
        dest.writeString(this.initials);
        dest.writeString(this.smsToken);
        dest.writeString(this.favorite);
        dest.writeByte(this.isCheck ? (byte) 1 : (byte) 0);
        dest.writeByte(this.isInDepart ? (byte) 1 : (byte) 0);
        dest.writeParcelable(this.postUserInfo, flags);
    }

    public void readFromParcel(Parcel source) {
        this.id = source.readString();
        this.userId = source.readString();
        this.tenantId = source.readString();
        this.account = source.readString();
        this.name = source.readString();
        this.realName = source.readString();
        this.avatar = source.readString();
        this.email = source.readString();
        this.phone = source.readString();
        this.birthday = source.readString();
        this.sex = (Integer) source.readValue(Integer.class.getClassLoader());
        this.roleId = source.readString();
        this.deptId = source.readString();
        this.postId = source.readString();
        this.createUser = (Long) source.readValue(Long.class.getClassLoader());
        this.createDept = (Long) source.readValue(Long.class.getClassLoader());
        this.createTime = source.readString();
        this.updateUser = source.readString();
        this.updateTime = source.readString();
        this.status = (Integer) source.readValue(Integer.class.getClassLoader());
        this.isDeleted = (Integer) source.readValue(Integer.class.getClassLoader());
        this.idCard = source.readString();
        this.orgId = source.readString();
        this.policeNo = source.readString();
        this.userType = source.readString();
        this.extDeptId = source.readString();
        this.deptName = source.readString();
        this.postName = source.readString();
        this.postCode = source.readString();
        this.loginToken = source.readString();
        this.sort = (Integer) source.readValue(Integer.class.getClassLoader());
        this.initials = source.readString();
        this.smsToken = source.readString();
        this.favorite = source.readString();
        this.isCheck = source.readByte() != 0;
        this.isInDepart = source.readByte() != 0;
        this.postUserInfo = source.readParcelable(UserInfo.class.getClassLoader());
    }

    protected UserInfo(Parcel in) {
        this.id = in.readString();
        this.userId = in.readString();
        this.tenantId = in.readString();
        this.account = in.readString();
        this.name = in.readString();
        this.realName = in.readString();
        this.avatar = in.readString();
        this.email = in.readString();
        this.phone = in.readString();
        this.birthday = in.readString();
        this.sex = (Integer) in.readValue(Integer.class.getClassLoader());
        this.roleId = in.readString();
        this.deptId = in.readString();
        this.postId = in.readString();
        this.createUser = (Long) in.readValue(Long.class.getClassLoader());
        this.createDept = (Long) in.readValue(Long.class.getClassLoader());
        this.createTime = in.readString();
        this.updateUser = in.readString();
        this.updateTime = in.readString();
        this.status = (Integer) in.readValue(Integer.class.getClassLoader());
        this.isDeleted = (Integer) in.readValue(Integer.class.getClassLoader());
        this.idCard = in.readString();
        this.orgId = in.readString();
        this.policeNo = in.readString();
        this.userType = in.readString();
        this.extDeptId = in.readString();
        this.deptName = in.readString();
        this.postName = in.readString();
        this.postCode = in.readString();
        this.loginToken = in.readString();
        this.sort = (Integer) in.readValue(Integer.class.getClassLoader());
        this.initials = in.readString();
        this.smsToken = in.readString();
        this.favorite = in.readString();
        this.isCheck = in.readByte() != 0;
        this.isInDepart = in.readByte() != 0;
        this.postUserInfo = in.readParcelable(UserInfo.class.getClassLoader());
    }

    public static final Creator<UserInfo> CREATOR = new Creator<UserInfo>() {
        @Override
        public UserInfo createFromParcel(Parcel source) {
            return new UserInfo(source);
        }

        @Override
        public UserInfo[] newArray(int size) {
            return new UserInfo[size];
        }
    };
}
